﻿@model StoreModel
@{
    Layout = "~/Views/Shared/_Root.cshtml";
    Html.AddTitleParts(!String.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Name);
}
@using Nop.Core;
@using Nop.Core.Domain.Common;
@using Nop.Core.Domain.Customers
@using Nop.Core.Infrastructure;
@using Nop.Web;
@using Nop.Web.Framework.UI;
@using Nop.Web.Models.Catalog;
@using Nop.Web.Extensions;
@*product search box*@
@Html.Action("SearchBox", "Catalog")
@{
    var isLogin = !EngineContext.Current.Resolve<IWorkContext>().CurrentCustomer.IsGuest();
}
<div class="manufacturer-page">
<div class="page-title">
        <h1>@Model.Name</h1>
    </div>

    <div class="store-image">
        <img style="border-width: 0px;" alt="@Model.PictureModel.AlternateText" src="@Model.PictureModel.ImageUrl" title="@Model.PictureModel.Title" />
    </div>
    <div class="store-description">
        @Html.Raw(Model.Description)
        
        @* Add to Favorite Store *@
        <a href="@Url.Action("_AddStoreToFavorite", "Catalog", new { area = "Commerce", storeId = Model })" data-role="button" data-theme="d">
            Add to Favorite Store
        </a><br />     
    </div>
                            

    @*<table style="width:100%">
    <tr>
        <td>
            <div class="store-description">
                @Html.Raw(Model.Description)
            </div>
        </td>
            <td>
                <div class="store-image">
                <img style="border-width: 0px;" alt="@Model.PictureModel.AlternateText" src="@Model.PictureModel.ImageUrl" title="@Model.PictureModel.Title" />
            </div>
        </td>
    </tr>
    </table>*@
   <div class="clear" style="padding:10px 0 10px;">
    </div>
    @* <hr /> *@
    @*description*@
    <div class="store-description">
    
        @if (Model.Branches.Count > 0)
        {
            <div class="store-branches">
                <h2>@T("Stores.Branches")</h2>
                @foreach (var branch in Model.Branches)
                {
                    string ViewOnGoogleMaps = string.Format("http://maps.google.com/maps?f=q&hl=en&ie=UTF8&oe=UTF8&geocode=&q={0}", Server.UrlEncode(branch.Address1 + " " + branch.ZipPostalCode + " " + branch.City + " " + branch.CountryName));
                    string ViewImgOnGoogleMaps = string.Format("https://maps.googleapis.com/maps/api/staticmap?center={0}&zoom=14&size=288x200&markers=Madison, WI|{0}&sensor=false", Server.UrlEncode(branch.Address1 + " " + branch.ZipPostalCode + " " + branch.City + " " + branch.CountryName));
                    
                    <div class="store-branch">
                        <h4>@branch.Name</h4>
                        @if (!string.IsNullOrEmpty(branch.PhoneNumber))
                        {@branch.PhoneNumber}
                        @*{<text>@T("Stores.Branches.Phone"): </text>@branch.PhoneNumber}*@
                        @if (!string.IsNullOrEmpty(branch.FaxNumber) && !string.IsNullOrEmpty(branch.PhoneNumber))
                        {<text> | </text>}
                        @if (!string.IsNullOrEmpty(branch.FaxNumber))
                        {<text>@T("Stores.Branches.Fax"): </text>@branch.FaxNumber}
                        <br />
                        @if (!string.IsNullOrEmpty(branch.Address1))
                        {@branch.Address1}
                        @if (!string.IsNullOrEmpty(branch.Address1) && !string.IsNullOrEmpty(branch.Address2))
                        {<text> </text>}
                        @if (!string.IsNullOrEmpty(branch.Address2))
                        {@branch.Address2}
                        @if (!string.IsNullOrEmpty(branch.Address1) || !string.IsNullOrEmpty(branch.Address2))
                        {<text>, </text>}
                        @if (!string.IsNullOrEmpty(branch.City))
                        {@branch.City}
                        <br />
                        @if (!string.IsNullOrEmpty(branch.CountryName))
                        {
                            @branch.CountryName
                            <br />    
                        }
                        @if (!string.IsNullOrEmpty(ViewOnGoogleMaps))
                        { 
                            @*<img alt="google maps" src="@Url.Content("~/subsites/Administration/Content/images/google-maps.gif")" />
                            <a href="@Html.Raw(ViewOnGoogleMaps)" target="_blank">@T("Stores.Branches.ViewOnGoogleMaps")</a>
                            <br />*@
                            
                            @* Show Google Map Thumbnail Pic *@
                            @* string ViewImgOnGoogleMaps = string.Format("https://maps.googleapis.com/maps/api/staticmap?center={0}&zoom=14&size=288x200&markers=Madison, WI|{0}&sensor=false", Server.UrlEncode(branch.Address1 + " " + branch.ZipPostalCode + " " + branch.City + " " + branch.CountryName)); *@
                            @* <a href="@Html.Raw(ViewOnGoogleMaps)" target="_blank">
                                <img src="@Html.Raw(ViewImgOnGoogleMaps)" class="img-map" height="200" width="288" />
                            </a>*@
                            
                            @*<a href="@Html.Raw(ViewOnGoogleMaps)" data-role="button" data-theme="d" data-corners="false" data-shadow="false" data-inline="true">*@
                           
                            <a href="@Html.Raw(ViewOnGoogleMaps)" data-role="button" data-theme="d" data-shadow="false" data-corners="false">
                               <img alt="google maps" src="@Url.Content("~/subsites/Administration/Content/images/google-maps.gif")" /> 
                                @T("Stores.Branches.ViewOnGoogleMaps")
                            </a>
                            <br />
                        }
                        @if (!string.IsNullOrEmpty(branch.Email))
                        {<a href = "mailto:@branch.Email">@branch.Email</a>@*alt="@branch.Email"*@}
                        @if (!string.IsNullOrEmpty(branch.Website) && !string.IsNullOrEmpty(branch.Email))
                        {<text> | </text>}
                        @if (!string.IsNullOrEmpty(branch.Website))
                        {<a href = "http://@branch.Website" target="_blank" >@branch.Website </a>@*alt="@branch.Name"*@}
                        <!--<hr style=" border: 1px dotted" /> -->                                                                                                   
                    </div>
                }
        </div> 
        }
    </div>
    <div class="clear" style="padding:10px 0 10px;">
        @*<hr />*@
    </div>


    
    @*featured products*@
    @if (Model.FeaturedProducts.Count > 0)
    {
        <div class="featured-product-grid">
            <div class="title">
                @T("Products.FeaturedProducts")
            </div>
            <div class="product-list">
                <ul data-role="listview" data-inset="true" data-filter="false" data-theme="c">
                    @foreach (var product in Model.Products)
                    {
                        <li>
                            @Html.Partial("_ProductBox", product)
                        </li>
                    }
                </ul>
            </div>
        </div>
        <div class="clear">
        </div>
    }
    
    
    
    
    @*product list*@
    @if (Model.Products.Count > 0)
    {
        <div class="product-list">
            <ul data-role="listview" data-inset="true" data-filter="false" data-theme="c">
                @foreach (var product in Model.Products)
                {
                    <li>
                        @Html.Partial("_ProductBox", product)
                    </li>
                }
            </ul>
        </div>
    }
    
    <div class="clear">
    </div>  
    
    <div class="pager">
    @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
    </div>
</div>
